import { defineStore } from 'pinia'
import { ref } from 'vue'

const useAsideStore = defineStore('aside', () => {
  // 声明数据
  const state = ref({
    isCollapse: false,
    asideWidth: '200px',
  })
  // 声明方法
  const change = () => {
    if (state.value.isCollapse) {
      state.value = {
        isCollapse: false,
        asideWidth: '200px',
      }
    } else {
      state.value = {
        isCollapse: true,
        asideWidth: '64px',
      }
    }
  }

  return { state, change }
})

export default useAsideStore
